package com.ukao.cashregister.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.ReceiveClothingBean;
import com.ukao.cashregister.bean.ReceiveProListBean;

import java.util.List;

/**
 * Created by ukaodev on 2017/6/14.
 * 衣物到店用的item展示adapter
 */

public class ReceiveProClothingListAdapter extends CommonAdapter<ReceiveClothingBean> {

    private boolean ishow;

    public ReceiveProClothingListAdapter(Context context, List<ReceiveClothingBean> datas) {
        super(context, datas, R.layout.arrive_clothing_recycler_item);

    }

    public void setShowBackgroundColor(boolean ishow) {
        this.ishow = ishow;
    }

    @Override
    public void convert(ViewHolder holder, ReceiveClothingBean item) {
        ImageView accessory = holder.getView(R.id.order_detail_accessory);
        if (ishow) {
            if (holder.getLayoutPosition() == 0) {
                holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.yellow));
            } else {
                holder.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.transparent));
            }
        }
        if (item.getOrderProType() == 2) {
            accessory.setVisibility(View.VISIBLE);
        } else {
            accessory.setVisibility(View.GONE);
        }
        holder.setText(R.id.scanCode, item.getScanCode());
        holder.setText(R.id.orderNo, item.getOrderNo());
        holder.setText(R.id.productName, item.getProductName());
        holder.setText(R.id.serviceName, item.getServiceName());
    }
}
